#include<bits/stdc++.h>
#define ll long long
#define endl '\n'
using namespace std;
const ll N=1e6+5;
ll n,x,a[N];
vector<pair<ll,ll> > v;
signed main(){
	freopen("rotate.in","r",stdin);
	freopen("rotate.out","w",stdout);
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	x=sqrt(n)+1;
	cout<<x<<" ";
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			ll p=0,jj=j;
			while(j<n&&a[j]>a[j+1]) p++,swap(a[j],a[j+1]),j++;
			for(int k=0;k<(p/(x-1));k++) v.push_back({1,jj+k*(x-1)});
			for(int k=0;k<(p%(x-1));k++) v.push_back({2,jj+max((p/(x-1)-1),1ll*0)*(x-1)+k});
		}
	}
	cout<<v.size()<<endl;
	for(int i=0;i<v.size();i++) cout<<v[i].first<<" "<<v[i].second<<endl;
	return 0;
}

